package com.baidu.process.chat.core.web.mapper;

import com.baidu.process.chat.core.web.entity.Evaluation;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 满意度评价
 *
 * @author: lws
 * @date: 2022/11/9
 */
public interface EvaluationMapper extends BaseMapper<Evaluation> {
    @Select("select \n" +
            "create_date createDate, \n" +
            "TRUNCATE(count(session_solution = '1' or null) / count(1), 2) solveRate,\n" +
            "TRUNCATE(count(star_value='1' or star_value='2' or null) / count(1), 2)  satisRate from evaluation\n" +
            "${ew.customSqlSegment}")
    List<Map<String, Object>> getEveryDayTotal(@Param(Constants.WRAPPER) Wrapper wrapper);
}
